<template>
    
    <!-- 组件的模板 -->
    <div class="page guide">
        <img class="guide-pic" src="../../static/imgs/guide_team.png" alt=""> 
        <div class="footer-box bg-color com-border-top">
            <a href="javascript:;" class="weui-btn weui-btn_primary FDC257" @click="gotoCreateTeam">创建企业，开始项目管理</a>
            <p class="tip">如您的公司已有企业，请联系管理员加入</p>
        </div>
    </div>  
</template>

<script> 
    /**
     *  引入工具类库 或 Native API
     *  example : import widget from 'gapi/widget'
     */
    import * as util from 'js/util.js'
    /**
     *  引入组件 以及 组件接口(Action)
     *  example : import Somecomponents from 'components/Somecomponents/Somecomponents'
     */

    /**
     *  组件实例对象
     */
    export default {
        components: {

        },
        data: function(){
            return{
                user_id:''
            }
        },
        vuex: {
            getters: {

            },
            actions: {

            }
        },
        methods: {
            /**
             * 初始化
             * @method init
             * @public
             * @return {Null} void
             */
            init (){
                util.ajax({
                    url:'/user/info',
                    type:'GET',
                    data:{
                        team_id:0,
                        project_id:0
                    },
                    timeout:10000,
                    success:(obj) => {
                        console.log(obj)
                        if(obj&&obj.errno == 0){
                            this.user_id = obj.data.user_id
                        }else{
                            widget.toast(obj.errmsg)
                        }
                    },
                    error: (xhr, status) => {
                        widget.toast('服务器异常')
                    },
                    noNetwork: () => {
                        widget.toast('网络连接失败，请检查网络')
                    }
                })
            },
            gotoCreateTeam (){
                let url = `backWhereParam=${111}&user_id=${this.user_id}`
                location.href = "dmsaas://CreateTeam?urdData="+encodeURIComponent(url)
            }
        },
        created(){

            this.init(); 
            
        }
        
    }

    
</script>

<!-- CSS 样式 -->
<style src="../../node_modules/weui/dist/style/weui.css"></style>
<style src="../../static/css/common.css"></style>
<style src="../../static/css/team.css"></style>
<style type="text/css">
    .FDC257{
        background-color: #FDC257!important;
    }
</style>



